package com.newy.domain.sys;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.Table;

import com.newy.core.hibernate.IdEntity;

/**
 * 用户登陆日志实体类
 * @author linzongxue
 *
 */
@Entity
@Table(name="sys_login_log")
public class LoginLog extends IdEntity {
	private Long userId;
	private Date loginTime;
	private Date logoutTime;
	private LogoutType logoutType;
	private String ipAddress;
	private String browser;
	private String sessionId;
	
	public Long getUserId() {
		return userId;
	}
	public void setUserId(Long userId) {
		this.userId = userId;
	}
	public Date getLoginTime() {
		return loginTime;
	}
	public void setLoginTime(Date loginTime) {
		this.loginTime = loginTime;
	}
	public Date getLogoutTime() {
		return logoutTime;
	}
	public void setLogoutTime(Date logoutTime) {
		this.logoutTime = logoutTime;
	}
	public LogoutType getLogoutType() {
		return logoutType;
	}
	public void setLogoutType(LogoutType logoutType) {
		this.logoutType = logoutType;
	}
	public String getIpAddress() {
		return ipAddress;
	}
	public void setIpAddress(String ipAddress) {
		this.ipAddress = ipAddress;
	}
	public String getBrowser() {
		return browser;
	}
	public void setBrowser(String browser) {
		this.browser = browser;
	}
	public String getSessionId() {
		return sessionId;
	}
	public void setSessionId(String sessionId) {
		this.sessionId = sessionId;
	}
	
	public enum LogoutType {
		/** 用户注销  */
		LOGOUT("用户注销"),
		/** 会话过期 */
		TIMEOUT("会话超时"),
		/** 会话被杀死 */
		KILLED("被踢除"),
		/** 意外退出 */
		UNEXPECTED("意外退出");
		
		private String text;
		private LogoutType(String text){
			this.text = text;
		};
		public String getText(){
			return text;
		}
	}
}
